//
//  MZY_AlbumCell.m
//  FullHouse
//
//  Created by dllo on 16/1/16.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_AlbumCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
#define HORIZONTAL [UIScreen mainScreen].bounds.size.width / 414
#define VERTICAL [UIScreen mainScreen].bounds.size.height / 736

@implementation MZY_AlbumCell

- (void)dealloc
{
    [self.backView release];
    [self.rightView release];
    [self.bigImageView release];
    [self.topImageView release];
    [self.bottomImageView release];
    [self.titleLabel release];
    [self.likeButton release];
    [self.likeCountLabel release];
    [self.rowTextField release];
    [self.authorImageView release];
    [self.authorLabel release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    self.backView = [[UIView alloc]init];
    self.backView.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.backView];
    [self.backView release];
    
    self.rightView = [[UIView alloc]init];
    self.rightView.backgroundColor = [UIColor whiteColor];
    [self.backView addSubview:self.rightView];
    [self.rightView release];
    
    self.bigImageView = [[UIImageView alloc]init];
    [self.rightView addSubview:self.bigImageView];
    [self.bigImageView release];
    
    self.topImageView = [[UIImageView alloc]init];
    [self.rightView addSubview:self.topImageView];
    [self.topImageView release];
    
    self.bottomImageView = [[UIImageView alloc]init];
    [self.rightView addSubview:self.bottomImageView];
    [self.bottomImageView release];
    
    self.titleLabel = [[UILabel alloc]init];
    [self.rightView addSubview:self.titleLabel];
    [self.titleLabel release];
    
    self.likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.rightView addSubview:self.likeButton];
    
    self.likeCountLabel = [[UILabel alloc]init];
    [self.rightView addSubview:self.likeCountLabel];
    [self.likeCountLabel release];
    
    self.rowTextField = [[UITextField alloc]init];
    self.rowTextField.backgroundColor = [UIColor lightGrayColor];
    [self.rightView addSubview:self.rowTextField];
    [self.rowTextField release];
    
    self.authorImageView = [[UIImageView alloc]init];
    [self.rightView addSubview:self.authorImageView];
    [self.authorImageView release];
    
    self.authorLabel = [[UILabel alloc]init];
    [self.rightView addSubview:self.authorLabel];
    [self.authorLabel release];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.backView.frame = CGRectMake(0, 0, WIDTH, 160 * HORIZONTAL);
    self.rightView.frame = CGRectMake(10, 10, WIDTH - 20, 140 * HORIZONTAL);
    self.bigImageView.frame = CGRectMake(0, 0, 140 * HORIZONTAL, 140 * HORIZONTAL);
    self.topImageView.frame = CGRectMake(142 * HORIZONTAL, 0, 69 * HORIZONTAL, 69 * HORIZONTAL);
    self.bottomImageView.frame = CGRectMake(142 * HORIZONTAL, 71 * HORIZONTAL, 69 * HORIZONTAL, 69 * HORIZONTAL);
    self.titleLabel.frame = CGRectMake(216 * HORIZONTAL, 5 * VERTICAL, 175 * HORIZONTAL, 40 * VERTICAL);
    self.likeButton.frame = CGRectMake(216 * HORIZONTAL, 56 * VERTICAL, 30 * HORIZONTAL, 30 * HORIZONTAL);
    self.likeCountLabel.frame = CGRectMake(256 * HORIZONTAL, 66 * VERTICAL, 40 * HORIZONTAL, 20 * VERTICAL);
    self.rowTextField.frame = CGRectMake(216 * HORIZONTAL, 91 * VERTICAL, 175 * HORIZONTAL, 1);
    self.authorImageView.frame = CGRectMake(216 * HORIZONTAL, HEIGHT - 65 * HORIZONTAL, 40 * HORIZONTAL, 40 * HORIZONTAL);
    self.authorLabel.frame = CGRectMake(262 * HORIZONTAL, HEIGHT - 55 * HORIZONTAL, 140 * HORIZONTAL, 30 * VERTICAL);
}

@end
